package com.sum.common.bean;

import java.util.Objects;

/**
 * 写入参数
 */
public class WriteParams {
    private final String password;
    private final int region;
    private final int startAddress;
    private final String readData;
    private final String writeData;

    public WriteParams(String password, int region, int startAddress, String readData,String writeData) {
        this.password = password;
        this.region = region;
        this.startAddress = startAddress;
        this.readData = readData;
        this.writeData = writeData;
    }

    public String getPassword() { return password; }
    public int getRegion() { return region; }
    public int getStartAddress() { return startAddress; }
    public String getWriteData() { return writeData; }

    public String getReadData() { return readData; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WriteParams that = (WriteParams) o;
        return region == that.region &&
                startAddress == that.startAddress &&
                Objects.equals(password, that.password) &&
                Objects.equals(writeData, that.writeData);
    }

    @Override
    public int hashCode() {
        return Objects.hash(password, region, startAddress, writeData);
    }

    @Override
    public String toString() {
        return "WriteParams{" +
                "password='" + password + '\'' +
                ", region=" + region +
                ", startAddress=" + startAddress +
                ", readData=" + readData +
                ", writeData='" + writeData + '\'' +
                '}';
    }
}